﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using Habanero.Faces.Base;
using Habanero.Faces.Win;
using ScintillaNet;

namespace FireStarterModeller.UI.ViewEditor
{
    public class ScintillaWinXmlEditor : ScintillaNet.Scintilla, IControlHabanero
    {
        public ScintillaWinXmlEditor()
        {
            this.ConfigurationManager.Language = "xml";
            this.Margins[0].Width = 20;
            INativeScintilla ns = this.NativeInterface;
            for (int i = 1; i < 128; i++)
            {
                ns.StyleSetFont(i, "Consolas");
                ns.StyleSetSize(i, 12);
            }
            ns.Modified += (sender, args) => this.OnTextChanged(args);
        }

        #region IControlHabanero

        /// <summary>
        /// Gets or sets the anchoring style.
        /// </summary>
        /// <value></value>
        AnchorStyles IControlHabanero.Anchor
        {
            get { return (AnchorStyles)base.Anchor; }
            set { base.Anchor = (System.Windows.Forms.AnchorStyles) value; }
        }

        /// <summary>
        /// Gets the collection of controls contained within the control
        /// </summary>
        IControlCollection IControlHabanero.Controls
        {
            get { return new ControlCollectionWin(base.Controls); }
        }

        /// <summary>
        /// Gets or sets which control borders are docked to its parent
        /// control and determines how a control is resized with its parent
        /// </summary>
        DockStyle IControlHabanero.Dock
        {
            get { return DockStyleWin.GetDockStyle(base.Dock); }
            set { base.Dock = DockStyleWin.GetDockStyle(value); }
        }

        #endregion

/*
        public new event MouseEventHandler MouseClick;

        public new event MouseEventHandler MouseDown;

        public new event MouseEventHandler MouseUp;

        public void PerformMouseClick(MouseEventArgs mouseEventArgs)
        {
            throw new NotImplementedException();
        }

        public void PerformMouseDown(MouseEventArgs mouseEventArgs)
        {
            throw new NotImplementedException();
        }

        public void PerformMouseUp(MouseEventArgs mouseEventArgs)
        {
            throw new NotImplementedException();
        }*/
    }
}
